<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>手机号码归属地查询</title>
</head>
<body>
    <div>
        <h2>手机号码归属地查询</h2>
        <form id="form">
            <input type="text" placeholder="输入手机号" id="phone"> &nbsp; <input type="submit" value="查询">
        </form>
        <p id="show"></p>
    </div>
<script>
(function (jsonp) {
    form.addEventListener('submit', function (e) {
        e.preventDefault()
        jsonp(phone.value)
    })
})(function (tel) {
    var sc = document.createElement('script')
    sc.addEventListener('load', function () {
        var r = window.__GetZoneResult_
        show.innerHTML = [r.carrier].toString()
        document.body.removeChild(sc)
    })
    document.body.appendChild(sc)
    sc.src = 'https://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel=' + tel
})
</script>
</body>
</html>